package com.sg.service.biz.framework.impl;


import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.common.util.RedisUtil;
import com.sg.dto.base.framework.req.*;
import com.sg.dto.biz.framework.req.*;
import com.sg.dto.biz.framework.res.*;
import com.sg.dto.integration.component.QueryClassMatchResultToAnswerDetailComReqDto;
import com.sg.dto.integration.component.QueryClassMatchResultToAnswerDetailComRespDto;
import com.wicket.okrcomponent.integration.ConfSchemeService;
import com.sg.common.exception.Assert;
import com.wicket.okrframework.common.exception.BizException;
import com.wicket.okrframework.dal.po.mbg.*;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class StaffingServiceImpl implements com.wicket.okrframework.biz.service.StaffingService {
    @Resource
    private RedisUtil redisUtil;
    @Resource
    private MStaffingAccountService mStaffingAccountService;
    @Resource
    private MOrganizationService mOrganizationService;
    @Resource
    private MStaffingService mStaffingService;
    @Resource
    private NbStaffing nbStaffing;
    @Resource
    private ConfSchemeService confSchemeService;
    @Resource
    private MPositionService mPositionService;
    @Resource
    private MInductionRecordService mInductionRecordService;
    @Resource
    private MOriginalRoleMemberInfoService mOriginalRoleMemberInfoService;
    @Resource
    private MUserinfoService mUserinfoService;
    @Resource
    private MDeptService mDeptService;
    @Resource
    private MPositionGradeService mPositionGradeService;
    @Resource
    private MStationService mStationService;
//@Resource
    //private MCustomFields2Service mCustomFields2Service;
//@Resource
    //private undefinedService undefinedService;

    /**
     * D1-3新增编制[1727]
     * gen by moon at 10/2/2022, 12:23:29 AM
     */
    @Trace(operationName = "D1-3新增编制")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public AddStaffingRespDto addStaffing(AddStaffingReqDto reqDto) {


        String string_1 = null;
//virtualUsage D2-3查询分组匹配结果转答案(公共)(跨服务）  5670
        QueryClassMatchResultToAnswerDetailComRespDto queryClassMatchResultToAnswerDetailComRespDto = null;
        QueryClassMatchResultToAnswerDetailComReqDto queryClassMatchResultToAnswerDetailComReqDto = new QueryClassMatchResultToAnswerDetailComReqDto();
        queryClassMatchResultToAnswerDetailComReqDto.setResultAspObjId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:106013_1_5670
        queryClassMatchResultToAnswerDetailComReqDto.setResultAspObjType("TENANT_SPACE");//sourceId:106014_1_5670
        queryClassMatchResultToAnswerDetailComReqDto.setConfItemClassCode("ORG_SET_CLASS");//CUSTOM_CONVENTION//sourceId:105972_1_5670
        queryClassMatchResultToAnswerDetailComReqDto.setIsInitialScheme("TRUE");//sourceId:308512_1_5670
        queryClassMatchResultToAnswerDetailComReqDto.setIsPlatData("FALSE");//sourceId:308513_1_5670

        /*D2-3查询分组匹配结果转答案(公共)(跨服务）[3088]   */
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getResultAspObjId(), "D1-3新增编制-D2-3查询分组匹配结果转答案(公共)(跨服务）-答案归属对象ID不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getResultAspObjType(), "D1-3新增编制-D2-3查询分组匹配结果转答案(公共)(跨服务）-答案归属对象类型不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getConfItemClassCode(), "D1-3新增编制-D2-3查询分组匹配结果转答案(公共)(跨服务）-分组标识不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getIsInitialScheme(), "D1-3新增编制-D2-3查询分组匹配结果转答案(公共)(跨服务）-是否初始方案答案不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getIsPlatData(), "D1-3新增编制-D2-3查询分组匹配结果转答案(公共)(跨服务）-是否平台数据不能为空", false);
        queryClassMatchResultToAnswerDetailComRespDto = confSchemeService.queryClassMatchResultToAnswerDetailCom(queryClassMatchResultToAnswerDetailComReqDto).getData();


//virtualUsage 1-3-14查询编制账户详情  2036
        StaffingAccount staffingAccount = null;
        QueryStaffingAccountDetailReq queryStaffingAccountDetailReq = new QueryStaffingAccountDetailReq();
        queryStaffingAccountDetailReq.setTypeCode("POSITION");//sourceId:54009_1_2036
        queryStaffingAccountDetailReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:54011_1_2036
        queryStaffingAccountDetailReq.setStatus("FALSE");//sourceId:54013_1_2036
        if (reqDto != null) {
            queryStaffingAccountDetailReq.setEntityId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:54010_1_2036
        }

        /*1-3-14查询编制账户详情[175]   */
        Assert.isNull(queryStaffingAccountDetailReq.getTypeCode(), "D1-3新增编制-1-3-14查询编制账户详情-所属对象实例类型不能为空", false);
        Assert.isNull(queryStaffingAccountDetailReq.getSubjectLifeCycle(), "D1-3新增编制-1-3-14查询编制账户详情-主体生命周期不能为空", false);
        Assert.isNull(queryStaffingAccountDetailReq.getStatus(), "D1-3新增编制-1-3-14查询编制账户详情-是否冻结不能为空", false);
        staffingAccount = mStaffingAccountService.queryStaffingAccountDetail(queryStaffingAccountDetailReq);


        if ((queryClassMatchResultToAnswerDetailComRespDto != null && queryClassMatchResultToAnswerDetailComRespDto.getOpenManyOrg() != null && queryClassMatchResultToAnswerDetailComRespDto.getOpenManyOrg().equals("FALSE"))) {
            //if(D2-3查询分组匹配结果转答案(公共)(跨服务）.是否开启多组织 等于 否)  1869

            Organization organization = null;
            QueryOrgDetailReq queryOrgDetailReq = new QueryOrgDetailReq();
            queryOrgDetailReq.setIsHighOrg("TRUE");//sourceId:52727_1_1882

            /*1-3-12查询组织详情[201]   */
            Assert.isNull(queryOrgDetailReq.getIsHighOrg(), "D1-3新增编制-1-3-12查询组织详情-是否最高组织不能为空", false);
            Assert.isNull(queryOrgDetailReq.getSpaceId(), "D1-3新增编制-1-3-12查询组织详情-创建于空间ID不能为空", false);
            organization = mOrganizationService.queryOrgDetail(queryOrgDetailReq);


            String string = null;
            if (staffingAccount != null && organization != null) {
                Staffing staffing = new Staffing();
                staffing.setIsAutoCreate("FALSE");//sourceId:52050_1_1883
                if (staffingAccount != null) {
                    staffing.setStaffingAccountId(staffingAccount.getStaffingAccountId());//SimpleFieldAssign//sourceId:54016_1_1883
                }
                if (reqDto != null) {
                    staffing.setIsPartTimeStaffing(reqDto.getIsPartTimeStaffing());//SimpleFieldAssign//sourceId:52051_1_1883
                    staffing.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:52534_1_1883
                    staffing.setPositionId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:52055_1_1883
                    staffing.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:52056_1_1883
                }
                if (organization != null) {
                    staffing.setOrganizationId(organization.getOrganizationId());//SimpleFieldAssign//sourceId:52134_1_1883
                }

                /*1-3-15新增编制[184]   */
                Assert.isNull(staffing.getIsAutoCreate(), "D1-3新增编制-1-3-15新增编制-是否自动创建不能为空", false);
                Assert.isNull(staffing.getIsPartTimeStaffing(), "D1-3新增编制-1-3-15新增编制-是否兼职编制不能为空", false);
                Assert.isNull(staffing.getPositionId(), "D1-3新增编制-1-3-15新增编制-职务ID不能为空", false);
                Assert.isNull(staffing.getSubjectLifeCycle(), "D1-3新增编制-1-3-15新增编制-主体生命周期不能为空", false);
                string = mStaffingService.addStaffing(staffing);


                string_1 = string;
            }
            if ((reqDto != null && reqDto.getSubjectLifeCycle() != null && reqDto.getSubjectLifeCycle().equals("CURRENTLY_VALID"))) {
                //if(D1-3新增职务编制.主体生命周期 等于 当前有效)  1873

//ModelCode: getDataCount
                AddCalculationAddAndSubRespDto getDataCountRes = null;
                if (string != null) {
                    AddCalculationAddAndSubReqDto getDataCountReq = new AddCalculationAddAndSubReqDto();
                    if (string != null) {
                        getDataCountReq.setStaffingId(string);//SimpleFieldAssign//sourceId:53346_1_1874
                    }

                    /*M-计算数值（特殊方法）[1746]  入参一个数据集，返回数据集条数 */
                    Assert.isNull(getDataCountReq.getStaffingId(), "D1-3新增编制-M-计算数值（特殊方法）-编制ID不能为空", false);
                    getDataCountRes = nbStaffing.addCalculationAddAndSub(getDataCountReq);


                }
                boolean bOOLEAN;
                if (staffingAccount != null) {
                    StaffingAccount staffingAccount_2 = new StaffingAccount();
                    if (staffingAccount != null) {
                        staffingAccount_2.setStaffingAccountId(staffingAccount.getStaffingAccountId());//SimpleFieldAssign//sourceId:54021_1_2037
                    }
                    if (getDataCountRes != null) {
                        staffingAccount_2.setStaffingNum(getDataCountRes.getStaffingNum());//SimpleFieldAssign//sourceId:54022_1_2037
                        staffingAccount_2.setVacantStaffingNumber(getDataCountRes.getStaffingNum());//SimpleFieldAssign//sourceId:54023_1_2037
                    }

                    /*1-3-14编制账户数量加值[1771]   */
                    Assert.isNull(staffingAccount_2.getStaffingNum(), "D1-3新增编制-1-3-14编制账户数量加值-编制数量不能为空", false);
                    Assert.isNull(staffingAccount_2.getVacantStaffingNumber(), "D1-3新增编制-1-3-14编制账户数量加值-空缺编制数量不能为空", false);
                    bOOLEAN = mStaffingAccountService.increaseStaffingAcntNum(staffingAccount_2);


                }
//processBranchName:正常结束 ,processBranchId:1876

            } else {
                //else  1877

//processBranchName:正常结束 ,processBranchId:1878

            }
        } else {
            //else  1879

            String string_2 = null;
            if (staffingAccount != null) {
                Staffing staffing_1 = new Staffing();
                staffing_1.setIsAutoCreate("FALSE");//sourceId:52050_1_1880
                if (staffingAccount != null) {
                    staffing_1.setStaffingAccountId(staffingAccount.getStaffingAccountId());//SimpleFieldAssign//sourceId:54016_1_1880
                }
                if (reqDto != null) {
                    staffing_1.setIsPartTimeStaffing(reqDto.getIsPartTimeStaffing());//SimpleFieldAssign//sourceId:52051_1_1880
                    staffing_1.setOrganizationId(reqDto.getOrganizationId());//SimpleFieldAssign//sourceId:52134_1_1880
                    staffing_1.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:52534_1_1880
                    staffing_1.setPositionId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:52055_1_1880
                    staffing_1.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:52056_1_1880
                }

                /*1-3-15新增编制[184]   */
                Assert.isNull(staffing_1.getIsAutoCreate(), "D1-3新增编制-1-3-15新增编制-是否自动创建不能为空", false);
                Assert.isNull(staffing_1.getIsPartTimeStaffing(), "D1-3新增编制-1-3-15新增编制-是否兼职编制不能为空", false);
                Assert.isNull(staffing_1.getPositionId(), "D1-3新增编制-1-3-15新增编制-职务ID不能为空", false);
                Assert.isNull(staffing_1.getSubjectLifeCycle(), "D1-3新增编制-1-3-15新增编制-主体生命周期不能为空", false);
                string_2 = mStaffingService.addStaffing(staffing_1);


                string_1 = string_2;
            }
            if ((reqDto != null && reqDto.getSubjectLifeCycle() != null && reqDto.getSubjectLifeCycle().equals("CURRENTLY_VALID"))) {
                //if(D1-3新增职务编制.主体生命周期 等于 当前有效)  1884

//ModelCode: getDataCount
                AddCalculationAddAndSubRespDto getDataCountRes_2 = null;
                if (string_2 != null) {
                    AddCalculationAddAndSubReqDto getDataCountReq_1 = new AddCalculationAddAndSubReqDto();
                    if (string_2 != null) {
                        getDataCountReq_1.setStaffingId(string_2);//SimpleFieldAssign//sourceId:53346_1_1885
                    }

                    /*M-计算数值（特殊方法）[1746]  入参一个数据集，返回数据集条数 */
                    Assert.isNull(getDataCountReq_1.getStaffingId(), "D1-3新增编制-M-计算数值（特殊方法）-编制ID不能为空", false);
                    getDataCountRes_2 = nbStaffing.addCalculationAddAndSub(getDataCountReq_1);


                }
                boolean bOOLEAN_1;
                if (staffingAccount != null) {
                    StaffingAccount staffingAccount_3 = new StaffingAccount();
                    if (staffingAccount != null) {
                        staffingAccount_3.setStaffingAccountId(staffingAccount.getStaffingAccountId());//SimpleFieldAssign//sourceId:54021_1_2038
                    }
                    if (getDataCountRes_2 != null) {
                        staffingAccount_3.setStaffingNum(getDataCountRes_2.getStaffingNum());//SimpleFieldAssign//sourceId:54022_1_2038
                        staffingAccount_3.setVacantStaffingNumber(getDataCountRes_2.getStaffingNum());//SimpleFieldAssign//sourceId:54023_1_2038
                    }

                    /*1-3-14编制账户数量加值[1771]   */
                    Assert.isNull(staffingAccount_3.getStaffingNum(), "D1-3新增编制-1-3-14编制账户数量加值-编制数量不能为空", false);
                    Assert.isNull(staffingAccount_3.getVacantStaffingNumber(), "D1-3新增编制-1-3-14编制账户数量加值-空缺编制数量不能为空", false);
                    bOOLEAN_1 = mStaffingAccountService.increaseStaffingAcntNum(staffingAccount_3);


                }
//processBranchName:正常结束 ,processBranchId:1887

            } else {
                //else  1888

//processBranchName:正常结束 ,processBranchId:1889

            }
        }
        AddStaffingRespDto retData = new AddStaffingRespDto();
        if (string_1 != null) {
            retData.setStaffingId(string_1);//SimpleFieldAssign//sourceId:52046_1
        }


        return retData;
    }

    /**
     * D1-3批量补充编制[1770]
     * gen by moon at 10/2/2022, 12:35:03 AM
     */
    @Trace(operationName = "D1-3批量补充编制")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public BatchUpdateStaffingRespDto batchUpdateStaffing(BatchUpdateStaffingReqDto reqDto) {


        //步骤0: M-第一层数据集循环开始（特殊方法） - addCycleCreate
        //ModelCode: circulationCollections
        for (OrgStaffingDto circulationCollectionsRes : reqDto.getOrgStaffingList()) {


//步骤1: 1-3-15查询编制列表 - queryStaffingList
            List<Staffing> listStaffing = new ArrayList<>();
            QueryStaffingListReq queryStaffingListReq = new QueryStaffingListReq();
            queryStaffingListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:53880_1
            if (circulationCollectionsRes != null) {
                queryStaffingListReq.setPositionId(circulationCollectionsRes.getPositionId());//SimpleFieldAssign//sourceId:53879_1
            }

            /*1-3-15查询编制列表[192]   */

            listStaffing = mStaffingService.queryStaffingList(queryStaffingListReq);


//步骤2: M-查询职务编制集合取X条数据（特殊方法） - queryCollectionDataDetail
            //ModelCode: collectionNData
            QueryCollectionDataDetailRespDto collectionNDataRes = null;
            if (listStaffing != null && listStaffing.size() > 0) {
                QueryCollectionDataDetailReqDto collectionNDataReq = new QueryCollectionDataDetailReqDto();
                collectionNDataReq.setOrgStaffingList(//objList-to-objLists
                        listStaffing.stream().map(item -> {
                            OrgStaffingDto elm = new OrgStaffingDto();
                            if (circulationCollectionsRes != null) {
                                elm.setPositionId(circulationCollectionsRes.getPositionId());//SimpleFieldAssign//sourceId:28949_2
                                elm.setStaffingId(circulationCollectionsRes.getStaffingId());//SimpleFieldAssign//sourceId:28948_2
                            }
                            return elm;
                        }).collect(Collectors.toList()));//objList-to-objLists//sourceId:53805_1
                if (circulationCollectionsRes != null) {
                    collectionNDataReq.setStaffingNum(circulationCollectionsRes.getStaffingNum());//SimpleFieldAssign//sourceId:53809_1
                }

                /*M-查询职务编制集合取X条数据（特殊方法）[1777]  入参数据集，取N条数据，出参数据集 */

                collectionNDataRes = nbStaffing.queryCollectionDataDetail(collectionNDataReq);


            }

//步骤3: 1-3-14批量修改编制 - batchUpdateStaffing
            boolean bOOLEAN;
            List<Staffing> listStaffing_2 = new ArrayList<>();
            if (collectionNDataRes != null) {
                listStaffing_2 = //objList-to-objLists
                        collectionNDataRes.getOrgStaffingList().stream().map(item -> {
                            Staffing elm = new Staffing();
                            if (item != null) {
                                elm.setStaffingId(item.getStaffingId());//SimpleFieldAssign//sourceId:28955_2
                                elm.setPositionId(item.getPositionId());//SimpleFieldAssign//sourceId:28966_2
                            }
                            if (circulationCollectionsRes != null) {
                                elm.setOrganizationId(circulationCollectionsRes.getOrganizationId());//SimpleFieldAssign//sourceId:28964_2
                            }
                            if (reqDto != null) {
                                elm.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:28965_2
                            }
                            return elm;
                        }).collect(Collectors.toList());//objList-to-objLists//sourceId:53822_1
            }

            /*1-3-14批量修改编制[931]   */

            bOOLEAN = mStaffingService.batchUpdateStaffing(listStaffing_2);


//步骤4: M-循环结束（特殊方法） - addCycleCreate
            //ModelCode: circulationEnd
        }


        BatchUpdateStaffingRespDto retData = new BatchUpdateStaffingRespDto();


        return retData;
    }

    /**
     * D1-3补充编制[1769]
     * gen by moon at 10/2/2022, 12:25:33 AM
     */
    @Trace(operationName = "D1-3补充编制")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public UpdateStaffingRespDto updateStaffing(UpdateStaffingReqDto reqDto) {


        //步骤0: 1-3-15查询编制列表 - queryStaffingList
        List<Staffing> listStaffing = new ArrayList<>();
        QueryStaffingListReq queryStaffingListReq = new QueryStaffingListReq();
        queryStaffingListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:53680_1
        if (reqDto != null) {
            queryStaffingListReq.setPositionId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:53679_1
        }

        /*1-3-15查询编制列表[192]   */

        listStaffing = mStaffingService.queryStaffingList(queryStaffingListReq);


//步骤1: M-查询职务编制集合取第一条数据（特殊方法） - queryCollectionFirstDataDetail
        //ModelCode: collectionFirstData

        Staffing collectionFirstDataRes = listStaffing.get(0);


//步骤2: 1-3-15修改编制 - updateStaffing
        boolean bOOLEAN;
        Staffing staffing = new Staffing();
        if (collectionFirstDataRes != null) {
            staffing.setStaffingId(collectionFirstDataRes.getStaffingId());//SimpleFieldAssign//sourceId:53548_1
        }
        if (reqDto != null) {
            staffing.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:53550_1
            staffing.setPositionId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:53551_1
            staffing.setOrganizationId(reqDto.getOrganizationId());//SimpleFieldAssign//sourceId:53552_1
            staffing.setSpaceId(reqDto.getSpaceId());//SimpleFieldAssign//sourceId:53664_1
        }

        /*1-3-15修改编制[186]   */

        bOOLEAN = mStaffingService.updateStaffing(staffing);


        UpdateStaffingRespDto retData = new UpdateStaffingRespDto();


        return retData;
    }

    /**
     * D1-3查询编制账户详情[1756]
     * gen by moon at 10/2/2022, 12:24:57 AM
     */
    @Trace(operationName = "D1-3查询编制账户详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryStaffingAccountDetailRespDto queryStaffingAccountDetail(QueryStaffingAccountDetailReqDto reqDto) {


        StaffingAccount staffingAccount_1 = null;
//步骤0: 1-3-14查询编制账户详情 - queryStaffingAccountDetail
        StaffingAccount staffingAccount = null;
        QueryStaffingAccountDetailReq queryStaffingAccountDetailReq = new QueryStaffingAccountDetailReq();
        if (reqDto != null) {
            queryStaffingAccountDetailReq.setTypeCode(reqDto.getTypeCode());//SimpleFieldAssign//sourceId:53260_1
            queryStaffingAccountDetailReq.setEntityId(reqDto.getEntityId());//SimpleFieldAssign//sourceId:53261_1
            queryStaffingAccountDetailReq.setSubjectLifeCycle(reqDto.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:53263_1
        }

        /*1-3-14查询编制账户详情[175]   */

        staffingAccount = mStaffingAccountService.queryStaffingAccountDetail(queryStaffingAccountDetailReq);


        staffingAccount_1 = staffingAccount;

        QueryStaffingAccountDetailRespDto retData = new QueryStaffingAccountDetailRespDto();
        if (staffingAccount_1 != null) {
            retData.setStaffingAccountId(staffingAccount_1.getStaffingAccountId());//SimpleFieldAssign//sourceId:53274_1
            retData.setStaffingNum(staffingAccount_1.getStaffingNum());//SimpleFieldAssign//sourceId:53275_1
            retData.setActualStaffingNumber(staffingAccount_1.getActualStaffingNumber());//SimpleFieldAssign//sourceId:53276_1
            retData.setVacantStaffingNumber(staffingAccount_1.getVacantStaffingNumber());//SimpleFieldAssign//sourceId:53277_1
        }


        return retData;
    }

    /**
     * D1-3批量新增编制[1747]
     * gen by moon at 10/2/2022, 12:24:45 AM
     */
    @Trace(operationName = "D1-3批量新增编制")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public BatchAddStaffingRespDto batchAddStaffing(BatchAddStaffingReqDto reqDto) {


        //virtualUsage D2-3查询分组匹配结果转答案(公共)(跨服务）  5671
        QueryClassMatchResultToAnswerDetailComRespDto queryClassMatchResultToAnswerDetailComRespDto = null;
        QueryClassMatchResultToAnswerDetailComReqDto queryClassMatchResultToAnswerDetailComReqDto = new QueryClassMatchResultToAnswerDetailComReqDto();
        queryClassMatchResultToAnswerDetailComReqDto.setResultAspObjId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:106067_1_5671
        queryClassMatchResultToAnswerDetailComReqDto.setResultAspObjType("TENANT_SPACE");//sourceId:106068_1_5671
        queryClassMatchResultToAnswerDetailComReqDto.setConfItemClassCode("ORG_SET_CLASS");//CUSTOM_CONVENTION//sourceId:106026_1_5671
        queryClassMatchResultToAnswerDetailComReqDto.setIsInitialScheme("TRUE");//sourceId:308510_1_5671
        queryClassMatchResultToAnswerDetailComReqDto.setIsPlatData("FALSE");//sourceId:308511_1_5671

        /*D2-3查询分组匹配结果转答案(公共)(跨服务）[3088]   */
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getConfItemClassCode(), "D1-3批量新增编制-D2-3查询分组匹配结果转答案(公共)(跨服务）-分组标识不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getIsInitialScheme(), "D1-3批量新增编制-D2-3查询分组匹配结果转答案(公共)(跨服务）-是否初始方案答案不能为空", false);
        Assert.isNull(queryClassMatchResultToAnswerDetailComReqDto.getIsPlatData(), "D1-3批量新增编制-D2-3查询分组匹配结果转答案(公共)(跨服务）-是否平台数据不能为空", false);
        queryClassMatchResultToAnswerDetailComRespDto = confSchemeService.queryClassMatchResultToAnswerDetailCom(queryClassMatchResultToAnswerDetailComReqDto).getData();


        if ((queryClassMatchResultToAnswerDetailComRespDto != null && queryClassMatchResultToAnswerDetailComRespDto.getOpenManyOrg() != null && queryClassMatchResultToAnswerDetailComRespDto.getOpenManyOrg().equals("TRUE"))) {
            //if(D2-3查询分组匹配结果转答案(公共)(跨服务）.是否开启多组织 等于 是)  1935

            Organization organization = null;
            QueryOrgDetailReq queryOrgDetailReq = new QueryOrgDetailReq();
            queryOrgDetailReq.setIsHighOrg("TRUE");//sourceId:53050_1_1937

            /*1-3-12查询组织详情[201]   */
            Assert.isNull(queryOrgDetailReq.getSpaceId(), "D1-3批量新增编制-1-3-12查询组织详情-创建于空间ID不能为空", false);
            organization = mOrganizationService.queryOrgDetail(queryOrgDetailReq);


            if ((reqDto != null && reqDto.getSubjectLifeCycle() != null && reqDto.getSubjectLifeCycle().equals("CURRENTLY_VALID"))) {
                //if(D1-3批量新增编制.主体生命周期 等于 当前有效)  1946

//ModelCode: circulationCollections
                for (OrgStaffingDto circulationCollectionsRes : reqDto.getOrgStaffingList()) {

                    StaffingAccount staffingAccount = null;
                    QueryStaffingAccountDetailReq queryStaffingAccountDetailReq = new QueryStaffingAccountDetailReq();
                    queryStaffingAccountDetailReq.setTypeCode("POSITION");//sourceId:54123_1_2213
                    queryStaffingAccountDetailReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:54125_1_2213
                    queryStaffingAccountDetailReq.setStatus("FALSE");//sourceId:54127_1_2213
                    if (circulationCollectionsRes != null) {
                        queryStaffingAccountDetailReq.setEntityId(circulationCollectionsRes.getPositionId());//SimpleFieldAssign//sourceId:54124_1_2213
                    }

                    /*1-3-14查询编制账户详情[175]   */
                    Assert.isNull(queryStaffingAccountDetailReq.getTypeCode(), "D1-3批量新增编制-1-3-14查询编制账户详情-所属对象实例类型不能为空", false);
                    Assert.isNull(queryStaffingAccountDetailReq.getSubjectLifeCycle(), "D1-3批量新增编制-1-3-14查询编制账户详情-主体生命周期不能为空", false);
                    Assert.isNull(queryStaffingAccountDetailReq.getStatus(), "D1-3批量新增编制-1-3-14查询编制账户详情-是否冻结不能为空", false);
                    staffingAccount = mStaffingAccountService.queryStaffingAccountDetail(queryStaffingAccountDetailReq);


                    boolean bOOLEAN;
                    if (staffingAccount != null) {
                        StaffingAccount staffingAccount_2 = new StaffingAccount();
                        if (staffingAccount != null) {
                            staffingAccount_2.setStaffingAccountId(staffingAccount.getStaffingAccountId());//SimpleFieldAssign//sourceId:54096_1_2040
                        }
                        if (circulationCollectionsRes != null) {
                            staffingAccount_2.setStaffingNum(circulationCollectionsRes.getStaffingNum());//SimpleFieldAssign//sourceId:54097_1_2040
                            staffingAccount_2.setVacantStaffingNumber(circulationCollectionsRes.getStaffingNum());//SimpleFieldAssign//sourceId:54098_1_2040
                        }

                        /*1-3-14编制账户数量加值[1771]   */
                        Assert.isNull(staffingAccount_2.getStaffingNum(), "D1-3批量新增编制-1-3-14编制账户数量加值-编制数量不能为空", false);
                        Assert.isNull(staffingAccount_2.getVacantStaffingNumber(), "D1-3批量新增编制-1-3-14编制账户数量加值-空缺编制数量不能为空", false);
                        bOOLEAN = mStaffingAccountService.increaseStaffingAcntNum(staffingAccount_2);


                    }
//ModelCode: circulationNumber
                    for (Long i20 = 0L, i20len = circulationCollectionsRes.getStaffingNum(); i20 < i20len; i20++) {

                        String string = null;
                        if (staffingAccount != null) {
                            Staffing staffing = new Staffing();
                            if (circulationCollectionsRes != null) {
                                staffing.setPositionId(circulationCollectionsRes.getPositionId());//SimpleFieldAssign//sourceId:54078_1_2041
                                staffing.setOrganizationId(circulationCollectionsRes.getOrganizationId());//SimpleFieldAssign//sourceId:54082_1_2041
                                staffing.setDeptId(circulationCollectionsRes.getDeptId());//SimpleFieldAssign//sourceId:54077_1_2041
                                staffing.setIsAutoCreate(circulationCollectionsRes.getIsAutoCreate());//SimpleFieldAssign//sourceId:54080_1_2041
                                staffing.setIsPartTimeStaffing(circulationCollectionsRes.getIsPartTimeStaffing());//SimpleFieldAssign//sourceId:54081_1_2041
                                staffing.setSubjectLifeCycle(circulationCollectionsRes.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:54079_1_2041
                            }
                            if (staffingAccount != null) {
                                staffing.setStaffingAccountId(staffingAccount.getStaffingAccountId());//SimpleFieldAssign//sourceId:54083_1_2041
                            }

                            /*1-3-15新增编制[184]   */
                            Assert.isNull(staffing.getPositionId(), "D1-3批量新增编制-1-3-15新增编制-职务ID不能为空", false);
                            Assert.isNull(staffing.getOrganizationId(), "D1-3批量新增编制-1-3-15新增编制-组织ID不能为空", false);
                            Assert.isNull(staffing.getDeptId(), "D1-3批量新增编制-1-3-15新增编制-部门ID不能为空", false);
                            Assert.isNull(staffing.getStaffingAccountId(), "D1-3批量新增编制-1-3-15新增编制-编制账户ID不能为空", false);
                            Assert.isNull(staffing.getIsAutoCreate(), "D1-3批量新增编制-1-3-15新增编制-是否自动创建不能为空", false);
                            Assert.isNull(staffing.getIsPartTimeStaffing(), "D1-3批量新增编制-1-3-15新增编制-是否兼职编制不能为空", false);
                            Assert.isNull(staffing.getSubjectLifeCycle(), "D1-3批量新增编制-1-3-15新增编制-主体生命周期不能为空", false);
                            string = mStaffingService.addStaffing(staffing);


                        }
//ModelCode: circulationEnd
                    }

//ModelCode: circulationEnd
                }

//processBranchName:正常结束 ,processBranchId:1950

            } else {
                //else  1952

//ModelCode: circulationCollections
                for (OrgStaffingDto circulationCollectionsRes_2 : reqDto.getOrgStaffingList()) {

                    StaffingAccount staffingAccount_3 = null;
                    QueryStaffingAccountDetailReq queryStaffingAccountDetailReq_1 = new QueryStaffingAccountDetailReq();
                    queryStaffingAccountDetailReq_1.setTypeCode("POSITION");//sourceId:54123_1_2214
                    queryStaffingAccountDetailReq_1.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:54125_1_2214
                    queryStaffingAccountDetailReq_1.setStatus("FALSE");//sourceId:54127_1_2214
                    if (circulationCollectionsRes_2 != null) {
                        queryStaffingAccountDetailReq_1.setEntityId(circulationCollectionsRes_2.getPositionId());//SimpleFieldAssign//sourceId:54124_1_2214
                    }

                    /*1-3-14查询编制账户详情[175]   */
                    Assert.isNull(queryStaffingAccountDetailReq_1.getTypeCode(), "D1-3批量新增编制-1-3-14查询编制账户详情-所属对象实例类型不能为空", false);
                    Assert.isNull(queryStaffingAccountDetailReq_1.getSubjectLifeCycle(), "D1-3批量新增编制-1-3-14查询编制账户详情-主体生命周期不能为空", false);
                    Assert.isNull(queryStaffingAccountDetailReq_1.getStatus(), "D1-3批量新增编制-1-3-14查询编制账户详情-是否冻结不能为空", false);
                    staffingAccount_3 = mStaffingAccountService.queryStaffingAccountDetail(queryStaffingAccountDetailReq_1);


//ModelCode: circulationNumber
                    for (Long i53 = 0L, i53len = circulationCollectionsRes_2.getStaffingNum(); i53 < i53len; i53++) {

                        String string_2 = null;
                        if (staffingAccount_3 != null) {
                            Staffing staffing_1 = new Staffing();
                            if (circulationCollectionsRes_2 != null) {
                                staffing_1.setPositionId(circulationCollectionsRes_2.getPositionId());//SimpleFieldAssign//sourceId:54078_1_2043
                                staffing_1.setOrganizationId(circulationCollectionsRes_2.getOrganizationId());//SimpleFieldAssign//sourceId:54082_1_2043
                                staffing_1.setDeptId(circulationCollectionsRes_2.getDeptId());//SimpleFieldAssign//sourceId:54077_1_2043
                                staffing_1.setIsAutoCreate(circulationCollectionsRes_2.getIsAutoCreate());//SimpleFieldAssign//sourceId:54080_1_2043
                                staffing_1.setIsPartTimeStaffing(circulationCollectionsRes_2.getIsPartTimeStaffing());//SimpleFieldAssign//sourceId:54081_1_2043
                                staffing_1.setSubjectLifeCycle(circulationCollectionsRes_2.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:54079_1_2043
                            }
                            if (staffingAccount_3 != null) {
                                staffing_1.setStaffingAccountId(staffingAccount_3.getStaffingAccountId());//SimpleFieldAssign//sourceId:54083_1_2043
                            }

                            /*1-3-15新增编制[184]   */
                            Assert.isNull(staffing_1.getPositionId(), "D1-3批量新增编制-1-3-15新增编制-职务ID不能为空", false);
                            Assert.isNull(staffing_1.getOrganizationId(), "D1-3批量新增编制-1-3-15新增编制-组织ID不能为空", false);
                            Assert.isNull(staffing_1.getDeptId(), "D1-3批量新增编制-1-3-15新增编制-部门ID不能为空", false);
                            Assert.isNull(staffing_1.getStaffingAccountId(), "D1-3批量新增编制-1-3-15新增编制-编制账户ID不能为空", false);
                            Assert.isNull(staffing_1.getIsAutoCreate(), "D1-3批量新增编制-1-3-15新增编制-是否自动创建不能为空", false);
                            Assert.isNull(staffing_1.getIsPartTimeStaffing(), "D1-3批量新增编制-1-3-15新增编制-是否兼职编制不能为空", false);
                            Assert.isNull(staffing_1.getSubjectLifeCycle(), "D1-3批量新增编制-1-3-15新增编制-主体生命周期不能为空", false);
                            string_2 = mStaffingService.addStaffing(staffing_1);


                        }
//ModelCode: circulationEnd
                    }

//ModelCode: circulationEnd
                }

//processBranchName:正常结束 ,processBranchId:1998

            }
        } else {
            //else  1954

            if ((reqDto != null && reqDto.getSubjectLifeCycle() != null && reqDto.getSubjectLifeCycle().equals("CURRENTLY_VALID"))) {
                //if(D1-3批量新增编制.主体生命周期 等于 当前有效)  1956

//ModelCode: circulationCollections
                for (OrgStaffingDto circulationCollectionsRes_3 : reqDto.getOrgStaffingList()) {

                    StaffingAccount staffingAccount_4 = null;
                    QueryStaffingAccountDetailReq queryStaffingAccountDetailReq_2 = new QueryStaffingAccountDetailReq();
                    queryStaffingAccountDetailReq_2.setTypeCode("POSITION");//sourceId:54123_1_2215
                    queryStaffingAccountDetailReq_2.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:54125_1_2215
                    queryStaffingAccountDetailReq_2.setStatus("FALSE");//sourceId:54127_1_2215
                    if (circulationCollectionsRes_3 != null) {
                        queryStaffingAccountDetailReq_2.setEntityId(circulationCollectionsRes_3.getPositionId());//SimpleFieldAssign//sourceId:54124_1_2215
                    }

                    /*1-3-14查询编制账户详情[175]   */
                    Assert.isNull(queryStaffingAccountDetailReq_2.getTypeCode(), "D1-3批量新增编制-1-3-14查询编制账户详情-所属对象实例类型不能为空", false);
                    Assert.isNull(queryStaffingAccountDetailReq_2.getSubjectLifeCycle(), "D1-3批量新增编制-1-3-14查询编制账户详情-主体生命周期不能为空", false);
                    Assert.isNull(queryStaffingAccountDetailReq_2.getStatus(), "D1-3批量新增编制-1-3-14查询编制账户详情-是否冻结不能为空", false);
                    staffingAccount_4 = mStaffingAccountService.queryStaffingAccountDetail(queryStaffingAccountDetailReq_2);


                    boolean bOOLEAN_1;
                    if (staffingAccount_4 != null) {
                        StaffingAccount staffingAccount_5 = new StaffingAccount();
                        if (staffingAccount_4 != null) {
                            staffingAccount_5.setStaffingAccountId(staffingAccount_4.getStaffingAccountId());//SimpleFieldAssign//sourceId:54096_1_2044
                        }
                        if (circulationCollectionsRes_3 != null) {
                            staffingAccount_5.setStaffingNum(circulationCollectionsRes_3.getStaffingNum());//SimpleFieldAssign//sourceId:54097_1_2044
                            staffingAccount_5.setVacantStaffingNumber(circulationCollectionsRes_3.getStaffingNum());//SimpleFieldAssign//sourceId:54098_1_2044
                        }

                        /*1-3-14编制账户数量加值[1771]   */
                        Assert.isNull(staffingAccount_5.getStaffingNum(), "D1-3批量新增编制-1-3-14编制账户数量加值-编制数量不能为空", false);
                        Assert.isNull(staffingAccount_5.getVacantStaffingNumber(), "D1-3批量新增编制-1-3-14编制账户数量加值-空缺编制数量不能为空", false);
                        bOOLEAN_1 = mStaffingAccountService.increaseStaffingAcntNum(staffingAccount_5);


                    }
//ModelCode: circulationNumber
                    for (Long i6 = 0L, i6len = circulationCollectionsRes_3.getStaffingNum(); i6 < i6len; i6++) {

                        String string_3 = null;
                        if (staffingAccount_4 != null) {
                            Staffing staffing_2 = new Staffing();
                            if (circulationCollectionsRes_3 != null) {
                                staffing_2.setPositionId(circulationCollectionsRes_3.getPositionId());//SimpleFieldAssign//sourceId:54078_1_2045
                                staffing_2.setOrganizationId(circulationCollectionsRes_3.getOrganizationId());//SimpleFieldAssign//sourceId:54082_1_2045
                                staffing_2.setDeptId(circulationCollectionsRes_3.getDeptId());//SimpleFieldAssign//sourceId:54077_1_2045
                                staffing_2.setIsAutoCreate(circulationCollectionsRes_3.getIsAutoCreate());//SimpleFieldAssign//sourceId:54080_1_2045
                                staffing_2.setIsPartTimeStaffing(circulationCollectionsRes_3.getIsPartTimeStaffing());//SimpleFieldAssign//sourceId:54081_1_2045
                                staffing_2.setSubjectLifeCycle(circulationCollectionsRes_3.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:54079_1_2045
                            }
                            if (staffingAccount_4 != null) {
                                staffing_2.setStaffingAccountId(staffingAccount_4.getStaffingAccountId());//SimpleFieldAssign//sourceId:54083_1_2045
                            }

                            /*1-3-15新增编制[184]   */
                            Assert.isNull(staffing_2.getPositionId(), "D1-3批量新增编制-1-3-15新增编制-职务ID不能为空", false);
                            Assert.isNull(staffing_2.getOrganizationId(), "D1-3批量新增编制-1-3-15新增编制-组织ID不能为空", false);
                            Assert.isNull(staffing_2.getDeptId(), "D1-3批量新增编制-1-3-15新增编制-部门ID不能为空", false);
                            Assert.isNull(staffing_2.getStaffingAccountId(), "D1-3批量新增编制-1-3-15新增编制-编制账户ID不能为空", false);
                            Assert.isNull(staffing_2.getIsAutoCreate(), "D1-3批量新增编制-1-3-15新增编制-是否自动创建不能为空", false);
                            Assert.isNull(staffing_2.getIsPartTimeStaffing(), "D1-3批量新增编制-1-3-15新增编制-是否兼职编制不能为空", false);
                            Assert.isNull(staffing_2.getSubjectLifeCycle(), "D1-3批量新增编制-1-3-15新增编制-主体生命周期不能为空", false);
                            string_3 = mStaffingService.addStaffing(staffing_2);


                        }
//ModelCode: circulationEnd
                    }

//ModelCode: circulationEnd
                }

//processBranchName:正常结束 ,processBranchId:1959

            } else {
                //else  1960

//ModelCode: circulationCollections
                for (OrgStaffingDto circulationCollectionsRes_4 : reqDto.getOrgStaffingList()) {

                    StaffingAccount staffingAccount_6 = null;
                    QueryStaffingAccountDetailReq queryStaffingAccountDetailReq_3 = new QueryStaffingAccountDetailReq();
                    queryStaffingAccountDetailReq_3.setTypeCode("POSITION");//sourceId:54123_1_2216
                    queryStaffingAccountDetailReq_3.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:54125_1_2216
                    queryStaffingAccountDetailReq_3.setStatus("FALSE");//sourceId:54127_1_2216
                    if (circulationCollectionsRes_4 != null) {
                        queryStaffingAccountDetailReq_3.setEntityId(circulationCollectionsRes_4.getPositionId());//SimpleFieldAssign//sourceId:54124_1_2216
                    }

                    /*1-3-14查询编制账户详情[175]   */
                    Assert.isNull(queryStaffingAccountDetailReq_3.getTypeCode(), "D1-3批量新增编制-1-3-14查询编制账户详情-所属对象实例类型不能为空", false);
                    Assert.isNull(queryStaffingAccountDetailReq_3.getSubjectLifeCycle(), "D1-3批量新增编制-1-3-14查询编制账户详情-主体生命周期不能为空", false);
                    Assert.isNull(queryStaffingAccountDetailReq_3.getStatus(), "D1-3批量新增编制-1-3-14查询编制账户详情-是否冻结不能为空", false);
                    staffingAccount_6 = mStaffingAccountService.queryStaffingAccountDetail(queryStaffingAccountDetailReq_3);


//ModelCode: circulationNumber
                    for (Long i4 = 0L, i4len = circulationCollectionsRes_4.getStaffingNum(); i4 < i4len; i4++) {

                        String string_4 = null;
                        if (staffingAccount_6 != null) {
                            Staffing staffing_3 = new Staffing();
                            if (circulationCollectionsRes_4 != null) {
                                staffing_3.setPositionId(circulationCollectionsRes_4.getPositionId());//SimpleFieldAssign//sourceId:54078_1_2046
                                staffing_3.setOrganizationId(circulationCollectionsRes_4.getOrganizationId());//SimpleFieldAssign//sourceId:54082_1_2046
                                staffing_3.setDeptId(circulationCollectionsRes_4.getDeptId());//SimpleFieldAssign//sourceId:54077_1_2046
                                staffing_3.setIsAutoCreate(circulationCollectionsRes_4.getIsAutoCreate());//SimpleFieldAssign//sourceId:54080_1_2046
                                staffing_3.setIsPartTimeStaffing(circulationCollectionsRes_4.getIsPartTimeStaffing());//SimpleFieldAssign//sourceId:54081_1_2046
                                staffing_3.setSubjectLifeCycle(circulationCollectionsRes_4.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:54079_1_2046
                            }
                            if (staffingAccount_6 != null) {
                                staffing_3.setStaffingAccountId(staffingAccount_6.getStaffingAccountId());//SimpleFieldAssign//sourceId:54083_1_2046
                            }

                            /*1-3-15新增编制[184]   */
                            Assert.isNull(staffing_3.getPositionId(), "D1-3批量新增编制-1-3-15新增编制-职务ID不能为空", false);
                            Assert.isNull(staffing_3.getOrganizationId(), "D1-3批量新增编制-1-3-15新增编制-组织ID不能为空", false);
                            Assert.isNull(staffing_3.getDeptId(), "D1-3批量新增编制-1-3-15新增编制-部门ID不能为空", false);
                            Assert.isNull(staffing_3.getStaffingAccountId(), "D1-3批量新增编制-1-3-15新增编制-编制账户ID不能为空", false);
                            Assert.isNull(staffing_3.getIsAutoCreate(), "D1-3批量新增编制-1-3-15新增编制-是否自动创建不能为空", false);
                            Assert.isNull(staffing_3.getIsPartTimeStaffing(), "D1-3批量新增编制-1-3-15新增编制-是否兼职编制不能为空", false);
                            Assert.isNull(staffing_3.getSubjectLifeCycle(), "D1-3批量新增编制-1-3-15新增编制-主体生命周期不能为空", false);
                            string_4 = mStaffingService.addStaffing(staffing_3);


                        }
//ModelCode: circulationEnd
                    }

//ModelCode: circulationEnd
                }

//processBranchName:正常结束 ,processBranchId:2010

            }
        }
        BatchAddStaffingRespDto retData = new BatchAddStaffingRespDto();


        return retData;
    }

    /**
     * D1-3存档编制[1737]
     * gen by moon at 10/2/2022, 12:24:30 AM
     */
    @Trace(operationName = "D1-3存档编制")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ArchiveStaffingRespDto archiveStaffing(ArchiveStaffingReqDto reqDto) {


        //virtualUsage 1-3-15查询编制详情  2011
        Staffing staffing = null;
        QueryStaffingDetailReq queryStaffingDetailReq = new QueryStaffingDetailReq();
        queryStaffingDetailReq.setInductionState("FALSE");//sourceId:53660_1_2011
        queryStaffingDetailReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:53661_1_2011
        queryStaffingDetailReq.setTempLock("FALSE");//sourceId:53662_1_2011
        if (reqDto != null) {
            queryStaffingDetailReq.setStaffingId(reqDto.getStaffingId());//SimpleFieldAssign//sourceId:53654_1_2011
        }

        /*1-3-15查询编制详情[191]   */
        Assert.isNull(queryStaffingDetailReq.getStaffingId(), "D1-3存档编制-1-3-15查询编制详情-编制ID不能为空", false);
        Assert.isNull(queryStaffingDetailReq.getInductionState(), "D1-3存档编制-1-3-15查询编制详情-编制是否在职不能为空", false);
        Assert.isNull(queryStaffingDetailReq.getSubjectLifeCycle(), "D1-3存档编制-1-3-15查询编制详情-主体生命周期不能为空", false);
        Assert.isNull(queryStaffingDetailReq.getTempLock(), "D1-3存档编制-1-3-15查询编制详情-临时锁定状态不能为空", false);
        staffing = mStaffingService.queryStaffingDetail(queryStaffingDetailReq);


        if ((staffing != null && staffing.getStaffingAccountId() != null)) {
            //if(1-3-15查询编制详情.编制账户ID 不等于空 )  2012

            boolean bOOLEAN;
            if (staffing != null) {
                Staffing staffing_2 = new Staffing();
                staffing_2.setSubjectLifeCycle("ARCHIVING");//sourceId:52531_1_2013
                staffing_2.setIsArchive("TRUE");//sourceId:52527_1_2013
                if (staffing != null) {
                    staffing_2.setStaffingId(staffing.getStaffingId());//SimpleFieldAssign//sourceId:52522_1_2013
                }

                /*1-3-15修改编制（存档）[186]   */
                Assert.isNull(staffing_2.getStaffingId(), "D1-3存档编制-1-3-15修改编制（存档）-编制ID不能为空", false);
                Assert.isNull(staffing_2.getSubjectLifeCycle(), "D1-3存档编制-1-3-15修改编制（存档）-主体生命周期不能为空", false);
                Assert.isNull(staffing_2.getIsArchive(), "D1-3存档编制-1-3-15修改编制（存档）-是否存档不能为空", false);
                bOOLEAN = mStaffingService.updateStaffing(staffing_2);


            }
//ModelCode: getDataCount
            AddCalculationAddAndSubRespDto getDataCountRes = null;
            if (staffing != null) {
                AddCalculationAddAndSubReqDto getDataCountReq = new AddCalculationAddAndSubReqDto();
                if (staffing != null) {
                    getDataCountReq.setStaffingId(staffing.getStaffingId());//SimpleFieldAssign//sourceId:53371_1_2017
                }

                /*M-计算数值（特殊方法）[1746]  入参一个数据集，返回数据集条数 */
                Assert.isNull(getDataCountReq.getStaffingId(), "D1-3存档编制-M-计算数值（特殊方法）-编制ID不能为空", false);
                getDataCountRes = nbStaffing.addCalculationAddAndSub(getDataCountReq);


            }
            boolean bOOLEAN_1;
            if (staffing != null) {
                StaffingAccount staffingAccount = new StaffingAccount();
                if (staffing != null) {
                    staffingAccount.setStaffingAccountId(staffing.getStaffingAccountId());//SimpleFieldAssign//sourceId:53658_1_2018
                }
                if (getDataCountRes != null) {
                    staffingAccount.setStaffingNum(getDataCountRes.getStaffingNum());//SimpleFieldAssign//sourceId:53606_1_2018
                    staffingAccount.setVacantStaffingNumber(getDataCountRes.getStaffingNum());//SimpleFieldAssign//sourceId:53607_1_2018
                }

                /*1-3-14编制账户数量减值[1772]   */
                Assert.isNull(staffingAccount.getStaffingAccountId(), "D1-3存档编制-1-3-14编制账户数量减值-编制账户ID不能为空", false);
                Assert.isNull(staffingAccount.getStaffingNum(), "D1-3存档编制-1-3-14编制账户数量减值-编制数量不能为空", false);
                Assert.isNull(staffingAccount.getVacantStaffingNumber(), "D1-3存档编制-1-3-14编制账户数量减值-空缺编制数量不能为空", false);
                bOOLEAN_1 = mStaffingAccountService.reduceStaffingAcntNum(staffingAccount);


            }
//processBranchName:正常结束 ,processBranchId:2034

        } else if ((staffing != null && staffing.getStaffingAccountId() == null)) {
            //elseif(1-3-15查询编制详情.编制账户ID 等于空 )  2014

//异常结束 2033
            throw new BizException("undefined", "undefined", false);
        }
        ArchiveStaffingRespDto retData = new ArchiveStaffingRespDto();


        return retData;
    }

    /**
     * D1-3发布编制[1736]
     * gen by moon at 10/2/2022, 12:24:18 AM
     */
    @Trace(operationName = "D1-3发布编制")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ReleaseStaffingRespDto releaseStaffing(ReleaseStaffingReqDto reqDto) {


        //virtualUsage 1-3-15查询编制详情  2019
        Staffing staffing = null;
        QueryStaffingDetailReq queryStaffingDetailReq = new QueryStaffingDetailReq();
        queryStaffingDetailReq.setSubjectLifeCycle("EDITING");//sourceId:53730_1_2019
        queryStaffingDetailReq.setTempLock("FALSE");//sourceId:53707_1_2019
        if (reqDto != null) {
            queryStaffingDetailReq.setStaffingId(reqDto.getStaffingId());//SimpleFieldAssign//sourceId:53700_1_2019
        }

        /*1-3-15查询编制详情[191]   */
        Assert.isNull(queryStaffingDetailReq.getStaffingId(), "D1-3发布编制-1-3-15查询编制详情-编制ID不能为空", false);
        Assert.isNull(queryStaffingDetailReq.getSubjectLifeCycle(), "D1-3发布编制-1-3-15查询编制详情-主体生命周期不能为空", false);
        Assert.isNull(queryStaffingDetailReq.getTempLock(), "D1-3发布编制-1-3-15查询编制详情-临时锁定状态不能为空", false);
        staffing = mStaffingService.queryStaffingDetail(queryStaffingDetailReq);


        if ((staffing != null && staffing.getStaffingAccountId() != null)) {
            //if(1-3-15查询编制详情.编制账户ID 不等于空 )  2020

            boolean bOOLEAN;
            if (staffing != null) {
                Staffing staffing_2 = new Staffing();
                staffing_2.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52373_1_2021
                if (staffing != null) {
                    staffing_2.setStaffingId(staffing.getStaffingId());//SimpleFieldAssign//sourceId:52352_1_2021
                }

                /*1-3-15修改编制（发布生效）[186]   */
                Assert.isNull(staffing_2.getStaffingId(), "D1-3发布编制-1-3-15修改编制（发布生效）-编制ID不能为空", false);
                Assert.isNull(staffing_2.getSubjectLifeCycle(), "D1-3发布编制-1-3-15修改编制（发布生效）-主体生命周期不能为空", false);
                bOOLEAN = mStaffingService.updateStaffing(staffing_2);


            }
//ModelCode: getDataCount
            AddCalculationAddAndSubRespDto getDataCountRes = null;
            if (staffing != null) {
                AddCalculationAddAndSubReqDto getDataCountReq = new AddCalculationAddAndSubReqDto();
                if (staffing != null) {
                    getDataCountReq.setStaffingId(staffing.getStaffingId());//SimpleFieldAssign//sourceId:53347_1_2022
                }

                /*M-计算数值（特殊方法）[1746]  入参一个数据集，返回数据集条数 */
                Assert.isNull(getDataCountReq.getStaffingId(), "D1-3发布编制-M-计算数值（特殊方法）-编制ID不能为空", false);
                getDataCountRes = nbStaffing.addCalculationAddAndSub(getDataCountReq);


            }
            boolean bOOLEAN_1;
            if (staffing != null) {
                StaffingAccount staffingAccount = new StaffingAccount();
                if (staffing != null) {
                    staffingAccount.setStaffingAccountId(staffing.getStaffingAccountId());//SimpleFieldAssign//sourceId:53746_1_2023
                }
                if (getDataCountRes != null) {
                    staffingAccount.setStaffingNum(getDataCountRes.getStaffingNum());//SimpleFieldAssign//sourceId:53593_1_2023
                    staffingAccount.setVacantStaffingNumber(getDataCountRes.getStaffingNum());//SimpleFieldAssign//sourceId:53594_1_2023
                }

                /*1-3-14编制账户数量加值[1771]   */
                Assert.isNull(staffingAccount.getStaffingAccountId(), "D1-3发布编制-1-3-14编制账户数量加值-编制账户ID不能为空", false);
                Assert.isNull(staffingAccount.getStaffingNum(), "D1-3发布编制-1-3-14编制账户数量加值-编制数量不能为空", false);
                Assert.isNull(staffingAccount.getVacantStaffingNumber(), "D1-3发布编制-1-3-14编制账户数量加值-空缺编制数量不能为空", false);
                bOOLEAN_1 = mStaffingAccountService.increaseStaffingAcntNum(staffingAccount);


            }
//processBranchName:正常结束 ,processBranchId:2032

        } else if ((staffing != null && staffing.getStaffingId() == null)) {
            //elseif(1-3-15查询编制详情.编制ID 等于空 )  2027

//异常结束 2031
            throw new BizException("undefined", "undefined", false);
        }
        ReleaseStaffingRespDto retData = new ReleaseStaffingRespDto();


        return retData;
    }

    /**
     * D1-3查询编制列表[1728]
     * gen by moon at 10/2/2022, 12:23:41 AM
     */
    @Trace(operationName = "D1-3查询编制列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public QueryStaffingListRespDto queryStaffingList(QueryStaffingListReqDto reqDto) {


        List<Position> listPosition_1 = new ArrayList<>();
        List<Staffing> listStaffing_1 = new ArrayList<>();
        List<InductionRecord> listInductionRecord_1 = new ArrayList<>();
        List<OriginalRoleMemberInfo> listOriginalRoleMemberInfo_1 = new ArrayList<>();
        List<Userinfo> listUserinfo_1 = new ArrayList<>();
        List<Dept> listDept_1 = new ArrayList<>();
        List<Position> listPosition_3 = new ArrayList<>();
        List<PositionGrade> listPositionGrade_1 = new ArrayList<>();
        List<Station> listStation_1 = new ArrayList<>();
        List<Staffing> listStaffing_3 = new ArrayList<>();
        if ((reqDto != null && reqDto.getStationId() != null)) {
            //if(D1-3查询编制列表.关联岗位ID 不等于空 )  1892

            List<Position> listPosition = new ArrayList<>();
            QueryPositionListReq queryPositionListReq = new QueryPositionListReq();
            queryPositionListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52929_1_1894
            queryPositionListReq.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID//sourceId:52937_1_1894
            if (reqDto != null) {
                queryPositionListReq.setStationId(reqDto.getStationId());//SimpleFieldAssign//sourceId:52926_1_1894
            }

            /*1-3-05查询职务列表（查岗位职务列表）[147]   */
            Assert.isNull(queryPositionListReq.getSubjectLifeCycle(), "D1-3查询编制列表-1-3-05查询职务列表（查岗位职务列表）-主体生命周期不能为空", false);
            Assert.isNull(queryPositionListReq.getSpaceId(), "D1-3查询编制列表-1-3-05查询职务列表（查岗位职务列表）-创建于空间ID不能为空", false);
            listPosition = mPositionService.queryPositionList(queryPositionListReq);


            listPosition_1 = listPosition;
            List<Staffing> listStaffing = new ArrayList<>();
            if (listPosition != null && listPosition.size() > 0) {
                BatchQueryPostMatchingStaffingReq batchQueryPostMatchingStaffingReq = new BatchQueryPostMatchingStaffingReq();
                batchQueryPostMatchingStaffingReq.setStaffingList(listPosition.stream().map(item -> item.getPositionId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52964_1_1895
                if (reqDto != null) {
                    batchQueryPostMatchingStaffingReq.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:52972_1_1895
                    batchQueryPostMatchingStaffingReq.setIsArchive(reqDto.getIsArchive());//SimpleFieldAssign//sourceId:52993_1_1895
                    batchQueryPostMatchingStaffingReq.setTempLock(reqDto.getTempLock());//SimpleFieldAssign//sourceId:52970_1_1895
                }

                /*1-3-14批量查询编制列表（查岗位职务的编制列表）[1282]   */

                listStaffing = mStaffingService.batchQueryPostMatchingStaffing(batchQueryPostMatchingStaffingReq);


                listStaffing_1 = listStaffing;
            }
            List<InductionRecord> listInductionRecord = new ArrayList<>();
            if (listStaffing != null && listStaffing.size() > 0) {
                BatchQueryInductionRecordByStaffingIDReq batchQueryInductionRecordByStaffingIDReq = new BatchQueryInductionRecordByStaffingIDReq();
                batchQueryInductionRecordByStaffingIDReq.setOrgInductionRecordList(listStaffing.stream().map(item -> item.getStaffingId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52212_1_1897
                batchQueryInductionRecordByStaffingIDReq.setIsArchive("FALSE");//sourceId:52213_1_1897

                /*1-3-13批量查询就职记录By编制ID[1731]   */
                Assert.isNull(batchQueryInductionRecordByStaffingIDReq.getIsArchive(), "D1-3查询编制列表-1-3-13批量查询就职记录By编制ID-是否存档不能为空", false);
                listInductionRecord = mInductionRecordService.batchQueryInductionRecordByStaffingID(batchQueryInductionRecordByStaffingIDReq);


                listInductionRecord_1 = listInductionRecord;
            }
            List<OriginalRoleMemberInfo> listOriginalRoleMemberInfo = new ArrayList<>();
            if (listInductionRecord != null && listInductionRecord.size() > 0) {
                BatchQueryBeginMembInfoListReq batchQueryBeginMembInfoListReq = new BatchQueryBeginMembInfoListReq();
                batchQueryBeginMembInfoListReq.setBeginMembInfoList(listInductionRecord.stream().map(item -> item.getOriginalRoleMemberId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52224_1_1898

                /*1-2-10批量查询身份人员资料列表[1014]   */

                listOriginalRoleMemberInfo = mOriginalRoleMemberInfoService.batchQueryBeginMembInfoList(batchQueryBeginMembInfoListReq);


                listOriginalRoleMemberInfo_1 = listOriginalRoleMemberInfo;
            }
            List<Userinfo> listUserinfo = new ArrayList<>();
            if (listInductionRecord != null && listInductionRecord.size() > 0) {
                BatchQueryUserinfoListReq batchQueryUserinfoListReq = new BatchQueryUserinfoListReq();
                batchQueryUserinfoListReq.setUserList(listInductionRecord.stream().map(item -> item.getUserId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52225_1_1899

                /*1-2-02批量查询个人资料列表[52]   */

                listUserinfo = mUserinfoService.batchQueryUserinfoList(batchQueryUserinfoListReq);


                listUserinfo_1 = listUserinfo;
            }
            List<Dept> listDept = new ArrayList<>();
            if (listStaffing != null && listStaffing.size() > 0) {
                BatchQueryDeptListReq batchQueryDeptListReq = new BatchQueryDeptListReq();
                batchQueryDeptListReq.setDeptList(listStaffing.stream().map(item -> item.getDeptId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52228_1_1900
                batchQueryDeptListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52240_1_1900

                /*1-3-09批量查询部门列表（查编制部门名称）[1153]   */
                Assert.isNull(batchQueryDeptListReq.getSubjectLifeCycle(), "D1-3查询编制列表-1-3-09批量查询部门列表（查编制部门名称）-主体生命周期不能为空", false);
                listDept = mDeptService.batchQueryDeptList(batchQueryDeptListReq);


                listDept_1 = listDept;
            }
            List<Position> listPosition_2 = new ArrayList<>();
            if (listStaffing != null && listStaffing.size() > 0) {
                BatchQueryPositionListReq batchQueryPositionListReq = new BatchQueryPositionListReq();
                batchQueryPositionListReq.setPositionList(listStaffing.stream().map(item -> item.getPositionId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52255_1_1901
                batchQueryPositionListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52258_1_1901

                /*1-3-05批量查询职务列表[1460]   */
                Assert.isNull(batchQueryPositionListReq.getSubjectLifeCycle(), "D1-3查询编制列表-1-3-05批量查询职务列表-主体生命周期不能为空", false);
                listPosition_2 = mPositionService.batchQueryPositionList(batchQueryPositionListReq);


                listPosition_3 = listPosition_2;
            }
            List<PositionGrade> listPositionGrade = new ArrayList<>();
            if (listPosition_2 != null && listPosition_2.size() > 0) {
                BatchQueryPositionGradeListReq batchQueryPositionGradeListReq = new BatchQueryPositionGradeListReq();
                batchQueryPositionGradeListReq.setOrgPositionGradeList(listPosition_2.stream().map(item -> item.getPositionGradeId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52281_1_1902
                batchQueryPositionGradeListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52282_1_1902

                /*1-3-03批量查询职务级别列表[1482]   */
                Assert.isNull(batchQueryPositionGradeListReq.getSubjectLifeCycle(), "D1-3查询编制列表-1-3-03批量查询职务级别列表-主体生命周期不能为空", false);
                listPositionGrade = mPositionGradeService.batchQueryPositionGradeList(batchQueryPositionGradeListReq);


                listPositionGrade_1 = listPositionGrade;
            }
            List<Station> listStation = new ArrayList<>();
            if (listPosition_2 != null && listPosition_2.size() > 0) {
                BatchQueryStationListReq batchQueryStationListReq = new BatchQueryStationListReq();
                batchQueryStationListReq.setStationList(listPosition_2.stream().map(item -> item.getStationId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52285_1_1903
                batchQueryStationListReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52286_1_1903

                /*1-3-07批量查询岗位列表[1466]   */
                Assert.isNull(batchQueryStationListReq.getSubjectLifeCycle(), "D1-3查询编制列表-1-3-07批量查询岗位列表-主体生命周期不能为空", false);
                listStation = mStationService.batchQueryStationList(batchQueryStationListReq);


                listStation_1 = listStation;
            }
//processBranchName:正常结束 ,processBranchId:1905

        } else {
            //else  1893

            List<Staffing> listStaffing_2 = new ArrayList<>();
            QueryStaffingListReq queryStaffingListReq = new QueryStaffingListReq();
            if (reqDto != null) {
                queryStaffingListReq.setOrganizationId(reqDto.getOrganizationId());//SimpleFieldAssign//sourceId:52107_1_1896
                queryStaffingListReq.setDeptId(reqDto.getDeptId());//SimpleFieldAssign//sourceId:52108_1_1896
                queryStaffingListReq.setPositionId(reqDto.getPositionId());//SimpleFieldAssign//sourceId:52109_1_1896
                queryStaffingListReq.setIsArchive(reqDto.getIsArchive());//SimpleFieldAssign//sourceId:52124_1_1896
                queryStaffingListReq.setTempLock(reqDto.getTempLock());//SimpleFieldAssign//sourceId:52139_1_1896
            }

            /*1-3-15查询编制列表[192]   */

            listStaffing_2 = mStaffingService.queryStaffingList(queryStaffingListReq);


            listStaffing_3 = listStaffing_2;
            List<InductionRecord> listInductionRecord_2 = new ArrayList<>();
            if (listStaffing_2 != null && listStaffing_2.size() > 0) {
                BatchQueryInductionRecordByStaffingIDReq batchQueryInductionRecordByStaffingIDReq_1 = new BatchQueryInductionRecordByStaffingIDReq();
                batchQueryInductionRecordByStaffingIDReq_1.setOrgInductionRecordList(listStaffing_2.stream().map(item -> item.getStaffingId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52212_1_1906
                batchQueryInductionRecordByStaffingIDReq_1.setIsArchive("FALSE");//sourceId:52213_1_1906

                /*1-3-13批量查询就职记录By编制ID[1731]   */
                Assert.isNull(batchQueryInductionRecordByStaffingIDReq_1.getIsArchive(), "D1-3查询编制列表-1-3-13批量查询就职记录By编制ID-是否存档不能为空", false);
                listInductionRecord_2 = mInductionRecordService.batchQueryInductionRecordByStaffingID(batchQueryInductionRecordByStaffingIDReq_1);


                listInductionRecord_1 = listInductionRecord_2;
            }
            List<OriginalRoleMemberInfo> listOriginalRoleMemberInfo_2 = new ArrayList<>();
            if (listInductionRecord_2 != null && listInductionRecord_2.size() > 0) {
                BatchQueryBeginMembInfoListReq batchQueryBeginMembInfoListReq_1 = new BatchQueryBeginMembInfoListReq();
                batchQueryBeginMembInfoListReq_1.setBeginMembInfoList(listInductionRecord_2.stream().map(item -> item.getOriginalRoleMemberId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52224_1_1907

                /*1-2-10批量查询身份人员资料列表[1014]   */

                listOriginalRoleMemberInfo_2 = mOriginalRoleMemberInfoService.batchQueryBeginMembInfoList(batchQueryBeginMembInfoListReq_1);


                listOriginalRoleMemberInfo_1 = listOriginalRoleMemberInfo_2;
            }
            List<Userinfo> listUserinfo_2 = new ArrayList<>();
            if (listInductionRecord_2 != null && listInductionRecord_2.size() > 0) {
                BatchQueryUserinfoListReq batchQueryUserinfoListReq_1 = new BatchQueryUserinfoListReq();
                batchQueryUserinfoListReq_1.setUserList(listInductionRecord_2.stream().map(item -> item.getUserId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52225_1_1908

                /*1-2-02批量查询个人资料列表[52]   */

                listUserinfo_2 = mUserinfoService.batchQueryUserinfoList(batchQueryUserinfoListReq_1);


                listUserinfo_1 = listUserinfo_2;
            }
            List<Dept> listDept_2 = new ArrayList<>();
            if (listStaffing_2 != null && listStaffing_2.size() > 0) {
                BatchQueryDeptListReq batchQueryDeptListReq_1 = new BatchQueryDeptListReq();
                batchQueryDeptListReq_1.setDeptList(listStaffing_2.stream().map(item -> item.getDeptId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52228_1_1909
                batchQueryDeptListReq_1.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52240_1_1909

                /*1-3-09批量查询部门列表（查编制部门名称）[1153]   */
                Assert.isNull(batchQueryDeptListReq_1.getSubjectLifeCycle(), "D1-3查询编制列表-1-3-09批量查询部门列表（查编制部门名称）-主体生命周期不能为空", false);
                listDept_2 = mDeptService.batchQueryDeptList(batchQueryDeptListReq_1);


                listDept_1 = listDept_2;
            }
            List<Position> listPosition_4 = new ArrayList<>();
            if (listStaffing_2 != null && listStaffing_2.size() > 0) {
                BatchQueryPositionListReq batchQueryPositionListReq_1 = new BatchQueryPositionListReq();
                batchQueryPositionListReq_1.setPositionList(listStaffing_2.stream().map(item -> item.getPositionId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52255_1_1910
                batchQueryPositionListReq_1.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52258_1_1910

                /*1-3-05批量查询职务列表[1460]   */
                Assert.isNull(batchQueryPositionListReq_1.getSubjectLifeCycle(), "D1-3查询编制列表-1-3-05批量查询职务列表-主体生命周期不能为空", false);
                listPosition_4 = mPositionService.batchQueryPositionList(batchQueryPositionListReq_1);


                listPosition_3 = listPosition_4;
            }
            List<PositionGrade> listPositionGrade_2 = new ArrayList<>();
            if (listPosition_4 != null && listPosition_4.size() > 0) {
                BatchQueryPositionGradeListReq batchQueryPositionGradeListReq_1 = new BatchQueryPositionGradeListReq();
                batchQueryPositionGradeListReq_1.setOrgPositionGradeList(listPosition_4.stream().map(item -> item.getPositionGradeId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52281_1_1911
                batchQueryPositionGradeListReq_1.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52282_1_1911

                /*1-3-03批量查询职务级别列表[1482]   */
                Assert.isNull(batchQueryPositionGradeListReq_1.getSubjectLifeCycle(), "D1-3查询编制列表-1-3-03批量查询职务级别列表-主体生命周期不能为空", false);
                listPositionGrade_2 = mPositionGradeService.batchQueryPositionGradeList(batchQueryPositionGradeListReq_1);


                listPositionGrade_1 = listPositionGrade_2;
            }
            List<Station> listStation_2 = new ArrayList<>();
            if (listPosition_4 != null && listPosition_4.size() > 0) {
                BatchQueryStationListReq batchQueryStationListReq_1 = new BatchQueryStationListReq();
                batchQueryStationListReq_1.setStationList(listPosition_4.stream().map(item -> item.getStationId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:52285_1_1912
                batchQueryStationListReq_1.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:52286_1_1912

                /*1-3-07批量查询岗位列表[1466]   */
                Assert.isNull(batchQueryStationListReq_1.getSubjectLifeCycle(), "D1-3查询编制列表-1-3-07批量查询岗位列表-主体生命周期不能为空", false);
                listStation_2 = mStationService.batchQueryStationList(batchQueryStationListReq_1);


                listStation_1 = listStation_2;
            }
//processBranchName:正常结束 ,processBranchId:1926

        }
        QueryStaffingListRespDto retData = new QueryStaffingListRespDto();
        //数据集融合  MoreListToOneSource
        if (listStaffing_1 != null && !CollectionUtil.isEmpty(listStaffing_1)) {
            for (Staffing staffing : listStaffing_1) {
                StaffingDto retElm = new StaffingDto();
                retElm.setStaffingId(staffing.getStaffingId());//SimpleFieldAssign//sourceId:27675_2
                retElm.setStaffingNumber(staffing.getStaffingNumber());//SimpleFieldAssign//sourceId:27676_2
                retElm.setIsPartTimeStaffing(staffing.getIsPartTimeStaffing());//SimpleFieldAssign//sourceId:27678_2
                retElm.setInductionState(staffing.getInductionState());//SimpleFieldAssign//sourceId:27677_2
                retElm.setTempLock(staffing.getTempLock());//SimpleFieldAssign//sourceId:27683_2
                retElm.setSubjectLifeCycle(staffing.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:27682_2
                retElm.setPositionId(staffing.getPositionId());//SimpleFieldAssign//sourceId:27681_2
                retElm.setDeptId(staffing.getDeptId());//SimpleFieldAssign//sourceId:27680_2
                retElm.setOrganizationId(staffing.getOrganizationId());//SimpleFieldAssign//sourceId:27679_2
                retData.getStaffingList().add(retElm);
                if (listDept_1 != null) {
                    for (Dept dept : listDept_1) {
                        if (dept.getDeptId().equals(staffing.getDeptId())) {
                            retElm.setDeptName(dept.getDeptName());//SimpleFieldAssign//sourceId:27693_2
                            retElm.setDeptShortName(dept.getDeptShortName());//SimpleFieldAssign//sourceId:27694_2
                        }
                    }
                }

            }
        }
//数据集融合  MoreListToOneSource
        if (listStaffing_3 != null && !CollectionUtil.isEmpty(listStaffing_3)) {
            for (Staffing staffing : listStaffing_3) {
                StaffingDto retElm = new StaffingDto();
                retElm.setStaffingId(staffing.getStaffingId());//SimpleFieldAssign//sourceId:27675_2
                retElm.setStaffingNumber(staffing.getStaffingNumber());//SimpleFieldAssign//sourceId:27676_2
                retElm.setIsPartTimeStaffing(staffing.getIsPartTimeStaffing());//SimpleFieldAssign//sourceId:27678_2
                retElm.setInductionState(staffing.getInductionState());//SimpleFieldAssign//sourceId:27677_2
                retElm.setTempLock(staffing.getTempLock());//SimpleFieldAssign//sourceId:27683_2
                retElm.setSubjectLifeCycle(staffing.getSubjectLifeCycle());//SimpleFieldAssign//sourceId:27682_2
                retElm.setPositionId(staffing.getPositionId());//SimpleFieldAssign//sourceId:27681_2
                retElm.setDeptId(staffing.getDeptId());//SimpleFieldAssign//sourceId:27680_2
                retElm.setOrganizationId(staffing.getOrganizationId());//SimpleFieldAssign//sourceId:27679_2
                retData.getStaffingList().add(retElm);
                if (listDept_1 != null) {
                    for (Dept dept : listDept_1) {
                        if (dept.getDeptId().equals(staffing.getDeptId())) {
                            retElm.setDeptName(dept.getDeptName());//SimpleFieldAssign//sourceId:27693_2
                            retElm.setDeptShortName(dept.getDeptShortName());//SimpleFieldAssign//sourceId:27694_2
                        }
                    }
                }

            }
        }//sourceId:52322_1


        return retData;
    }

    /**
     * D1-3执行批次发布编制处理(公共)[3763]
     * gen by moon at 9/20/2023, 11:29:16 PM
     */
    @Trace(operationName = "D1-3执行批次发布编制处理(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementBatchStaffingHandleComRespDto implementBatchStaffingHandleCom(ImplementBatchStaffingHandleComReqDto reqDto) {


        //virtualUsage 1-3-14批量修改编制（占用或释放）  11550
        boolean bOOLEAN;
        List<Staffing> listStaffing = new ArrayList<>();
        if (reqDto != null && reqDto.getStaffingList() != null && !CollectionUtil.isEmpty(reqDto.getStaffingList())) {
            listStaffing = reqDto.getStaffingList().stream().map(item -> BeanUtil.toBean(item, Staffing.class)).collect(Collectors.toList());//objList-to-objLists//sourceId:177963_1_11550
        }

        /*1-3-14批量修改编制（占用或释放）[931]   */

        bOOLEAN = mStaffingService.batchUpdateStaffing(listStaffing)/*vcase invoke 本地 method 方法调用;*/;


//virtualUsage 1-3-15批量编制ID查询编制账户（未去重）  11551
        List<Staffing> listStaffing_1 = new ArrayList<>();
        BatchQueryStaffingReq batchQueryStaffingReq = new BatchQueryStaffingReq();
        batchQueryStaffingReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:178005_1_11551
        if (reqDto != null && reqDto.getStaffingList() != null && !CollectionUtil.isEmpty(reqDto.getStaffingList())) {
            batchQueryStaffingReq.setStaffingList(reqDto.getStaffingList().stream().map(item -> item.getStaffingId())
                    .collect(Collectors.toList()));/*list-to-strings*///sourceId:178004_1_11551
        }

        /*1-3-15批量编制ID查询编制账户（未去重）[3767]   */
        Assert.isNull(batchQueryStaffingReq.getSubjectLifeCycle(), "D1-3执行批次发布编制处理(公共)-1-3-15批量编制ID查询编制账户（未去重）-主体生命周期不能为空", false);
        listStaffing_1 = mStaffingService.batchQueryStaffing(batchQueryStaffingReq)/*vcase invoke 本地 method 方法调用;*/;


//virtualUsage 1-3-14批量查询编制账户（已去重）  11552
        List<StaffingAccount> listStaffingAccount = new ArrayList<>();
        if (listStaffing_1 != null && !CollectionUtil.isEmpty(listStaffing_1) && listStaffing_1.size() > 0) {
            BatchQueryStaffingAccountReq batchQueryStaffingAccountReq = new BatchQueryStaffingAccountReq();
            batchQueryStaffingAccountReq.setSubjectLifeCycle("CURRENTLY_VALID");//sourceId:178130_1_11552
            if (listStaffing_1 != null && !CollectionUtil.isEmpty(listStaffing_1) && listStaffing_1 != null && !CollectionUtil.isEmpty(listStaffing_1)) {
                batchQueryStaffingAccountReq.setStaffingAccountList(listStaffing_1.stream().map(item -> item.getStaffingAccountId())
                        .collect(Collectors.toList()));/*list-to-strings*///sourceId:178129_1_11552
            }

            /*1-3-14批量查询编制账户（已去重）[3768]   */
            Assert.isNull(batchQueryStaffingAccountReq.getSubjectLifeCycle(), "D1-3执行批次发布编制处理(公共)-1-3-14批量查询编制账户（已去重）-主体生命周期不能为空", false);
            listStaffingAccount = mStaffingAccountService.batchQueryStaffingAccount(batchQueryStaffingAccountReq)/*vcase invoke 本地 method 方法调用;*/;


        }
//virtualUsage M1执行编制账户加减【循环开始】  11553
        //ModelCode: circulationCollections
        for (StaffingAccount circulationCollectionsRes : listStaffingAccount) {

//virtualUsage M1-编制账户数量加减传值（特殊方法）  11554
            //ModelCode: receptionService
            QueryReceiveFieldDetailRespDto receptionServiceRes = null;
            QueryReceiveFieldDetailReqDto receptionServiceReq = new QueryReceiveFieldDetailReqDto();
            receptionServiceReq.setOutputNum(Long.valueOf(1));//CUSTOM_CONVENTION//sourceId:301450_1_11554

            /*M1-编制账户数量加减传值（特殊方法）[3715]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq.getOutputNum(), "D1-3执行批次发布编制处理(公共)-M1-编制账户数量加减传值（特殊方法）-传输数值（整数型）不能为空", false);
            receptionServiceRes = nbStaffing.queryReceiveFieldDetail(receptionServiceReq);


//virtualUsage M1-获取本次新增或存档参数（分支用）  11557
            //ModelCode: receptionService
            QueryReceiveFieldDetailRespDto receptionServiceRes_2 = null;
            QueryReceiveFieldDetailReqDto receptionServiceReq_1 = new QueryReceiveFieldDetailReqDto();
            if (reqDto != null) {
                receptionServiceReq_1.setUpdateStatus(reqDto.getUpdateStatus());//SimpleFieldAssign//sourceId:178176_1_11557
            }

            /*M1-获取本次新增或存档参数（分支用）[3715]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_1.getUpdateStatus(), "D1-3执行批次发布编制处理(公共)-M1-获取本次新增或存档参数（分支用）-批次下更新状态不能为空", false);
            receptionServiceRes_2 = nbStaffing.queryReceiveFieldDetail(receptionServiceReq_1);


            if ((reqDto != null && reqDto.getUpdateStatus() != null && reqDto.getUpdateStatus().equals("NEW"))) {
                //if(D1-3执行批次发布编制处理(公共).批次下更新状态 等于 本次新增)  11558

                boolean bOOLEAN_1;
                StaffingAccount staffingAccount = new StaffingAccount();
                if (receptionServiceRes != null) {
                    staffingAccount.setActualStaffingNumber(receptionServiceRes.getOutputNum());//SimpleFieldAssign//sourceId:178210_1_11560
                    staffingAccount.setVacantStaffingNumber(receptionServiceRes.getOutputNum());//SimpleFieldAssign//sourceId:178211_1_11560
                }

                /*1-3-14加减更新发牌编制账户的在职子账户加减数量1[1780]   */
                Assert.isNull(staffingAccount.getStaffingAccountId(), "D1-3执行批次发布编制处理(公共)-1-3-14加减更新发牌编制账户的在职子账户加减数量1-编制账户ID不能为空", false);
                Assert.isNull(staffingAccount.getActualStaffingNumber(), "D1-3执行批次发布编制处理(公共)-1-3-14加减更新发牌编制账户的在职子账户加减数量1-冗余编制在职数量不能为空", false);
                Assert.isNull(staffingAccount.getVacantStaffingNumber(), "D1-3执行批次发布编制处理(公共)-1-3-14加减更新发牌编制账户的在职子账户加减数量1-空缺编制数量不能为空", false);
                bOOLEAN_1 = mStaffingAccountService.updateStaffOnAcntNum(staffingAccount)/*vcase invoke 本地 method 方法调用;*/;


            } else if ((reqDto != null && reqDto.getUpdateStatus() != null && reqDto.getUpdateStatus().equals("ARCHIVE"))) {
                //elseif(D1-3执行批次发布编制处理(公共).批次下更新状态 等于 本次存档)  11559

                boolean bOOLEAN_2;
                StaffingAccount staffingAccount_1 = new StaffingAccount();
                if (receptionServiceRes != null) {
                    staffingAccount_1.setActualStaffingNumber(receptionServiceRes.getOutputNum());//SimpleFieldAssign//sourceId:178213_1_11561
                    staffingAccount_1.setVacantStaffingNumber(receptionServiceRes.getOutputNum());//SimpleFieldAssign//sourceId:178214_1_11561
                }

                /*1-3-14加减更新发牌编制账户的空缺子账户加减数量1[1781]   */
                Assert.isNull(staffingAccount_1.getStaffingAccountId(), "D1-3执行批次发布编制处理(公共)-1-3-14加减更新发牌编制账户的空缺子账户加减数量1-编制账户ID不能为空", false);
                Assert.isNull(staffingAccount_1.getActualStaffingNumber(), "D1-3执行批次发布编制处理(公共)-1-3-14加减更新发牌编制账户的空缺子账户加减数量1-冗余编制在职数量不能为空", false);
                Assert.isNull(staffingAccount_1.getVacantStaffingNumber(), "D1-3执行批次发布编制处理(公共)-1-3-14加减更新发牌编制账户的空缺子账户加减数量1-空缺编制数量不能为空", false);
                bOOLEAN_2 = mStaffingAccountService.updateStaffOffAcntNum(staffingAccount_1)/*vcase invoke 本地 method 方法调用;*/;


            }
//virtualUsage M-循环结束（特殊方法）  11555
            //ModelCode: circulationEnd
        }

        ImplementBatchStaffingHandleComRespDto retData = new ImplementBatchStaffingHandleComRespDto();


        return retData;
    }

    /**
     * D1-执行批次存档编制处理(公共)[4205]
     * gen by moon at 12/24/2023, 5:07:55 AM
     */
    @Trace(operationName = "D1-执行批次存档编制处理(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementBatchStaffingArchiveComRespDto implementBatchStaffingArchiveCom(ImplementBatchStaffingArchiveComReqDto reqDto) {


        //步骤0: 1-3-14批量查询编制 - batchQueryStaffing
        List<Staffing> listStaffing = new ArrayList<>();
        BatchQueryStaffingReq batchQueryStaffingReq = new BatchQueryStaffingReq();
        if (reqDto != null) {
            batchQueryStaffingReq.setStaffingList(reqDto.getStaffingList());//list-field-assign//sourceId:259810_1
        }

        /*1-3-14批量查询编制[3767]   */

        listStaffing = mStaffingService.batchQueryStaffing(batchQueryStaffingReq)/*vcase invoke 本地 method 方法调用;*/;


//步骤1: D1-3执行批次发布编制处理(公共) - implementBatchStaffingHandleCom
        ImplementBatchStaffingHandleComRespDto implementBatchStaffingHandleComRespDto = null;
        if (listStaffing != null && !CollectionUtil.isEmpty(listStaffing) && listStaffing.size() > 0 && listStaffing != null && !CollectionUtil.isEmpty(listStaffing) && listStaffing != null && !CollectionUtil.isEmpty(listStaffing) && listStaffing.size() > 0) {
            ImplementBatchStaffingHandleComReqDto implementBatchStaffingHandleComReqDto = new ImplementBatchStaffingHandleComReqDto();
            implementBatchStaffingHandleComReqDto.setStaffingList(//objList-to-objLists
                    listStaffing.stream().map(item -> {
                        StaffingDto elm = new StaffingDto();
                        elm.setInductionState("FALSE");//sourceId:89456_2
                        elm.setTempLock("FALSE");//sourceId:89457_2
                        if (reqDto != null) {
                            elm.setStaffingId(item.getStaffingId());//SimpleFieldAssign//sourceId:89455_2
                        }
                        return elm;
                    }).collect(Collectors.toList()));//objList-to-objLists//sourceId:259808_1
            implementBatchStaffingHandleComReqDto.setUpdateStatus("ARCHIVE");//sourceId:259809_1

            /*D1-3执行批次发布编制处理(公共)[3763]   */
            Assert.isNull(implementBatchStaffingHandleComReqDto.getUpdateStatus(), "D1-执行批次存档编制处理(公共)-D1-3执行批次发布编制处理(公共)-批次下更新状态不能为空", false);
            implementBatchStaffingHandleComRespDto = implementBatchStaffingHandleCom(implementBatchStaffingHandleComReqDto)/*vcase invoke 同服务,同domain*/;


        }

        ImplementBatchStaffingArchiveComRespDto retData = new ImplementBatchStaffingArchiveComRespDto();


        return retData;
    }

    /**
     * D1-执行批次新增编制处理(公共)[4204]
     * gen by moon at 9/20/2023, 11:29:18 PM
     */
    @Trace(operationName = "D1-执行批次新增编制处理(公共)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementBatchStaffingCreateComRespDto implementBatchStaffingCreateCom(ImplementBatchStaffingCreateComReqDto reqDto) {


        //步骤0: 1-3-14批量查询编制 - batchQueryStaffing
        List<Staffing> listStaffing = new ArrayList<>();
        BatchQueryStaffingReq batchQueryStaffingReq = new BatchQueryStaffingReq();
        if (reqDto != null) {
            batchQueryStaffingReq.setStaffingList(reqDto.getStaffingList());//list-field-assign//sourceId:259803_1
        }

        /*1-3-14批量查询编制[3767]   */

        listStaffing = mStaffingService.batchQueryStaffing(batchQueryStaffingReq)/*vcase invoke 本地 method 方法调用;*/;


//步骤1: D1-3执行批次发布编制处理(公共) - implementBatchStaffingHandleCom
        ImplementBatchStaffingHandleComRespDto implementBatchStaffingHandleComRespDto = null;
        if (listStaffing != null && !CollectionUtil.isEmpty(listStaffing) && listStaffing.size() > 0 && listStaffing != null && !CollectionUtil.isEmpty(listStaffing) && listStaffing != null && !CollectionUtil.isEmpty(listStaffing) && listStaffing.size() > 0) {
            ImplementBatchStaffingHandleComReqDto implementBatchStaffingHandleComReqDto = new ImplementBatchStaffingHandleComReqDto();
            implementBatchStaffingHandleComReqDto.setUpdateStatus("NEW");//sourceId:259726_1
            if (listStaffing != null && !CollectionUtil.isEmpty(listStaffing) && listStaffing != null && !CollectionUtil.isEmpty(listStaffing)) {
                implementBatchStaffingHandleComReqDto.setStaffingList(listStaffing.stream().map(item -> {
                    StaffingDto elm = BeanUtil.toBean(item, StaffingDto.class);
                    elm.setInductionState("TRUE");
                    elm.setTempLock("FALSE");

                    return elm;
                }).collect(Collectors.toList()));//objList-to-objLists//sourceId:259725_1
            }

            /*D1-3执行批次发布编制处理(公共)[3763]   */
            Assert.isNull(implementBatchStaffingHandleComReqDto.getUpdateStatus(), "D1-执行批次新增编制处理(公共)-D1-3执行批次发布编制处理(公共)-批次下更新状态不能为空", false);
            implementBatchStaffingHandleComRespDto = implementBatchStaffingHandleCom(implementBatchStaffingHandleComReqDto)/*vcase invoke 同服务,同domain*/;


        }

        ImplementBatchStaffingCreateComRespDto retData = new ImplementBatchStaffingCreateComRespDto();


        return retData;
    }

    //
}
